// app.js
App({
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
  },
  
getCurrTime() {
	const date = new Date();
	let time = {
		year: date.getFullYear(), //年
		month: date.getMonth() + 1, // 月
		day: date.getDate(), // 日
		hours: date.getHours(), // 时
		minutes: date.getMinutes(), // 分
		seconds: date.getSeconds() // 秒
	};
    // time.month = (time.month < 10) ? ('0'+ time.month) : time.month
    if (time.month < 10) {
		time.month = '0' + time.month;
	}
    if (time.day < 10) {
		time.day = '0' + time.day;
	}
	if (time.hours < 10) {
		time.hours = '0' + time.hours;
	}
	if (time.minutes < 10) {
		time.minutes = '0' + time.minutes;
	}
	if (time.seconds < 10) {
		time.seconds = '0' + time.seconds;
	}
  const currTime = time.year + '-' + time.month + '-' + time.day + ' ' + time.hours + ':' + time.minutes + ':' + time.seconds;
  return time.year + '-' + time.month + '-' + time.day
},
  globalData: {
    userInfo: null
  }
})
